
if(WScript.FullName.toLowerCase().indexOf("wscript") >= 0)
{
	WScript.echo("Please use cscript.exe scripting host to run this script.");
	WScript.quit();
}

try
{
	var pdvb = GetObject("", "OSH.ProgDVB")

	WScript.ConnectObject(pdvb, "pdvb_");
}
catch(e)
{
	WScript.echo("ProgDVB exception: " + e.number + " (" + e.description + ")");
	WScript.quit();
}

WScript.echo("Press Ctrl+C to exit...");
while(true)
{
	WScript.sleep(10000);
}

WScript.quit();


function pdvb_OnChannelChange(channelId)
{
	WScript.echo("Channel changed: " + pdvb.Channel.Name);
}

function pdvb_OnRecordStart(recordingInfo)
{
	WScript.echo("Recording started");
	recordingInfo = null;
}

function pdvb_OnRecordStop(recordingInfo)
{
	WScript.echo("Recording stoped");
	recordingInfo = null;
}

function pdvb_OnRecordProgress(recordingInfo)
{
	WScript.echo("Recording " + recordingInfo.TotalTime + "...");
	recordingInfo = null;
}

function pdvb_OnOSDShow()
{
	WScript.echo("OSD has been shown");
}

function pdvb_OnOSDHide()
{
	WScript.echo("OSD has been hidden");
}

function pdvb_OnKey(k)
{
	WScript.echo("Key " + k + " pressed");
}

function pdvb_OnCommand(command)
{
	WScript.echo("Command: " + command);
}

